home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
prgtools
/
langs
/
dl_exsrc.zoo
/
catch.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1994-07-03
|
348 b
|
24 lines
#include <setjmp.h>
#include "extras.h"
static int hold_rv;
int catch(context, func)
jmp_buf context;
int (*func) __PROTO((void));
{
if (setjmp(context) == 0) {
return (*func)();
} else {
return hold_rv;
}
}
void throw(context, rv)
jmp_buf context;
int rv;
{
hold_rv = rv;
longjmp(context, 1);
}